﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SMS_Agent.Util
{
    public class DateTime_Util
    {
        public static DateTime GetCurrentTime()
        {
            return DateTime.Now;
        }

        public static DateTime StartOfDay(DateTime date)
        {
            return new DateTime(date.Year, date.Month, date.Day, 0, 0, 0, 0);
        }

        public static DateTime EndOfDay(DateTime date)
        {
            return new DateTime(date.Year, date.Month, date.Day, 23, 59, 59, 999);
        }

        private static void SomeStartEndDateSamples()
        {
            DateTime baseDate = DateTime.Today;

            DateTime today = baseDate;
            DateTime yesterday = baseDate.AddDays(-1);
            DateTime thisWeekStart = baseDate.AddDays(-(int)baseDate.DayOfWeek);
            DateTime thisWeekEnd = thisWeekStart.AddDays(7).AddSeconds(-1);
            DateTime lastWeekStart = thisWeekStart.AddDays(-7);
            DateTime lastWeekEnd = thisWeekStart.AddSeconds(-1);
            DateTime thisMonthStart = baseDate.AddDays(1 - baseDate.Day);
            DateTime thisMonthEnd = thisMonthStart.AddMonths(1).AddSeconds(-1);
            DateTime lastMonthStart = thisMonthStart.AddMonths(-1);
            DateTime lastMonthEnd = thisMonthStart.AddSeconds(-1);
        }
    }
}